#ifndef MOVIE_RENDERER_H
#define MOVIE_RENDERER_H

#include "framerenderer.h"
#include "moviedecoder.h"
#include "SubtitleRenderer/subtitlerenderer.h"
#include "Osd/infodisplay.h"
#include "GLLib/text.h"

#include <string>

class AudioRenderer;

class MovieRenderer
{
public:
    MovieRenderer(int width, int height);
    ~MovieRenderer();

    void setWindowSize(int width, int height);
    bool setMovieFile(const std::string& movieFilename);

    void play();
    void pause();
    void stop();
    void seek(int offset);

    void adjustVolume(float offset);
    void toggleShader(const std::string& shaderFilename);
    void toggleDebugInfo();
    void adjustBrightness(float offset);
    void adjustGamma(float offset);
    void adjustContrast(float offset);
    void resetImageSettings();
    void setStretchToFit(bool enabled);
    void flipHorizontal();
    void flipVertical();

    void toggleOsd();

    void render(uint64 elapsedTime);

private:
    void renderOsd(uint64 elapsedTime);
    void renderDebugInfo();

    private:
    AudioRenderer*      m_pAudioRenderer;
    FrameRenderer       m_FrameRenderer;
    MovieDecoder        m_MovieDecoder;
    SubtitleRenderer    m_SubtitleRenderer;
    InfoDisplay         m_InfoDisplay;

    bool                m_ShowOsd;
    bool                m_Paused;
    bool                m_ShowDebugInfo;

    int                 m_WindowWidth;
    int                 m_WindowHeight;
    int                 m_OsdWidth;
    int                 m_OsdHeight;
    int                 m_OsdOffsetX;
    float               m_VisibleOsdPercentage;

    double              m_AudioClock;
    double              m_VideoClock;

    GL::Text            m_DebugInfo;
};

#endif
